<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <title></title>
                <!--<meta name="viewport" content="width=device-width, initial-scale=1.0">-->
                <link href="/diaoyou_server/Public/css/style.css" rel="stylesheet" type="text/css" />
                <link href="/diaoyou_server/Public/css/select.css" rel="stylesheet" type="text/css" />
                <style type="text/css">
                        body{
                                /*min-width: 1500px;*/
                        }
                        table.gridtable {
                                font-family: verdana,arial,sans-serif;
                                font-size:11px;
                                color:#333333;
                                border-width: 1px;
                                border-color: #666666;
                                border-collapse: collapse;
                        }
                        table.gridtable th {
                                border-width: 1px;
                                padding: 8px;
                                border-style: solid;
                                border-color: #666666;
                                background-color: #dedede;
                        }
                        table.gridtable td {
                                border-width: 1px;
                                padding: 8px;
                                border-style: solid;
                                border-color: #666666;
                                background-color: #ffffff;
                        }

                        input{
                                border: 1px solid; border-color: #CCC #EEE #EEE #CCC;
                                background: #F5F5F5;
                        }
                </style>
                <script type="text/javascript" src="/diaoyou_server/Public/js/jquery-1.9.0.min.js"></script>
                <script type="text/javascript" src="/diaoyou_server/Public/js/layer/layer.js"></script>
                <script type="text/javascript" src="/diaoyou_server/Public/js/jquery.idTabs.min.js"></script>
                <script type="text/javascript" src="/diaoyou_server/Public/js/select-ui.min.js"></script>
                <script type="text/javascript" src="/diaoyou_server/Public/js/editor/kindeditor.js"></script>
                <script type="text/javascript">
                        KE.show({
                                id: 'content7',
                                cssPath: './index.css'
                        });


                        $(window).resize(function() {
                                setWidth();
                        });
                        function setWidth() {
                                var width = ($('.leftinfos').width() - 12) / 2;
                                $('.infoleft,.inforight').width(width);
//                                $(".mainright").width($(window).width() - 570);
                                $(".mainright").width($(window).width() - 570);
                                if ($(".mainright").width() < 800) {
                                        $(".mainright").width(800);
                                }
//                                $(".mainright").height($(window).height() - 180);
                                $(".mainright").height(290);
                                $(".dflist").width($(".mainright").width());
                                //$(".dflist").height($(".mainright").height());
                                $(".dflist").css("margin-bottom", 5);
//                                alert($(window).height());
                                //$("#jsonResult").height($(document).height() - 450);
                                $("#jsonResult").css("background-color", "#EEEEEE");
                        }

                        function testApi(url, args) {
                                //alert("1");
                                $.ajax({
                                        type: "GET",
                                        url: url,
                                        dataType: "text",
                                        data: args, //var args = {"time": new Date(), "n_id": n_id, "new_name": new_name};
                                        success: function(msg) {
                                                $("#jsonResultTextArea").html(msg);
                                        }
                                });
                        }

                        function createUrl(obj) {
                                //alert($(obj).text("123"));
                                //alert($(obj).parent().parent().parent().children().length)
                                var rows = $(obj).parent().parent().parent().children().length;
                                var params = "";
                                for (var i = 1; i < rows; i++) {
                                        //alert($(obj).parent().parent().parent().children().eq(i).children().eq(0).text());//app_key username password
                                        //alert($(obj).parent().parent().parent().children().eq(i).children().eq(4).children().eq(0).val())
                                        params += $(obj).parent().parent().parent().children().eq(i).children().eq(0).text() + "=" + $(obj).parent().parent().parent().children().eq(i).children().eq(4).children().eq(0).val() + "&";
                                }
                                //alert($(obj).attr("name"));
                                //s=s.ToString().RTrim(‘,')
                                //param=param.ToString().RTrim('&');
//                                if(param.charAt(param.length – 1) == '&'){
//                                        param =param.substr(param.length-1,1);
//                                }
                                //alert(param.substring(0,param.length-1));
                                params = params.substring(0, params.length - 1);//去掉最后一个&
                                //alert($(obj).parent().parent().parent().parent().parent().parent().parent().parent().children().eq(1).children().eq(0).children().eq(1).children().eq(2).children().eq(0).text());
                                $(obj).parent().parent().parent().parent().parent().parent().parent().parent().children().eq(1).children().eq(0).children().eq(1).children().eq(2).children().eq(0).text(params);
                        }

                        function sendRequest(obj) {
                                //alert($(obj).parent().parent().children().eq(1).children().eq(0).text());
                                var requestUrl = $(obj).parent().parent().children().eq(1).children().eq(0).text();
                                var args = $(obj).parent().parent().children().eq(2).children().eq(0).text();
                                //alert(args);
                                var str = args.split('&')
                                var arrayObj = new Array([str.length]);
                                for (var i = 0; i < str.length; i++) {
                                        var str1 = str[i].split('=');
                                        param = new Object();
                                        param.key = str1[0];
                                        param.value = str1[1];
                                        arrayObj[i] = param;
                                }
//                               alert(JSON.stringify(arrayObj)) 
                                //var params = JSON.stringify(arrayObj);
                                testApi(requestUrl, args);
                        }

                        $(function() {
                                console.log("/diaoyou_server/Home/Api/menu")
                                $(".mainleft").width(500);
                                //$(".mainright").width($(window).width() - 570);
                                $(".mainright").css("background-color", "#FDF7DB");
                                $(".mainleft").css("background-color", "#EEEEEE");
//                                alert($(window).width());
                                setWidth();
                                $(".select1").uedSelect({
                                        width: 345
                                });
                                $(".select2").uedSelect({
                                        width: 167
                                });
                                $(".select3").uedSelect({
                                        width: 100
                                });

                                //$("#a").css("background-color","red");
                                $("#jsonResultTextArea").width($("#jsonResultDiv").width() - 10);
                                $("#jsonResultTextArea").height($("#jsonResultDiv").height());
                                /*
                                 $("#userLoginApiFormSubmit").click(function() {
                                 //alert("click");
                                 var url = "/diaoyou_server/Api/UserApi/userLogin";
                                 var args = {"username": "umgsai1", "password": "123456"};
                                 testApi(url, args);
                                 });
                                 */

                                $(".itab").find("a").click(function() {
                                        $("#jsonResultTextArea").text("");
                                });
                        });
                </script>
        </head>
        <body>
                <div class="place">
                        <span>位置：</span>
                        <ul class="placeul">
                                <li><a href="#">API</a></li>
                                <li><a href="#">用户</a></li>
                        </ul>
                </div>
                <div class="formbody">
                        <div id="usual1" class="usual"> 
                                <div class="itab">
                                        <ul> 
                                                <li><a href="#tab1" class="selected">userLogin</a></li> 
                                                <li><a href="#tab2">get_user</a></li> 
                                                <li><a href="#tab3">list_user</a></li> 
                                                <li><a href="#tab4">reg_user</a></li> 
                                                <!--
                                                <li><a href="#tab5">自定义1</a></li> 
                                                <li><a href="#tab6">自定义1</a></li> 
                                                <li><a href="#tab7">自定义1</a></li> 
                                                <li><a href="#tab8">自定义1</a></li> 
                                                <li><a href="#tab9">自定义1</a></li>
                                                        
                                                -->
                                        </ul><hr/>
                                </div> 

                                <div id="tab1" class="tabson">

                                        <div class="formtext">
                                                <b>用户登录接口</b>
                                        </div>

                                        <div class="mainbox">
                                                <div class="mainleft">
                                                        <div class="leftinfo">
                                                                <div class="listtitle">
                                                                        <!--<a href="#" class="more1">更多</a>-->
                                                                        接口说明
                                                                </div>
                                                                <div class="newlist">  
                                                                        <table  class="gridtable">
                                                                                <tr>
                                                                                        <th>字段名称</th><th>备注</th><th>数据类型</th><th>是否必选</th><th>值</th>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>app_key</td><td>App key</td><td>String</td><td>true</td><td><input type="text" name="app_key" placeholder="必填" required="required" onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>phone</td><td>手机号码</td><td>String</td><td>true</td><td><input type="text" name="phone"  placeholder="必填" onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>password</td><td>密码</td><td>String</td><td>true</td><td><input type="text" name="password"  placeholder="必填" onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                        </table>
                                                                </div>

                                                        </div>

                                                </div>
                                                <!--mainleft end-->
                                                <div class="mainright">
                                                        <div class="dflist">
                                                                <div class="listtitle">
                                                                        <!--<a href="#" class="more1">更多</a>-->
                                                                        调用方式
                                                                </div>    
                                                                <ul class="newlist">
                                                                        <li>请求方式：<request_method>get</request_method></li>
                                                                        <li>请求URL：<request_url>/diaoyou_server/Api/UserApi/userLogin</request_url></li>
                                                                        <li>请求参数：<request_params></request_params></li>
                                                                        <br/>
                                                                        <li><input name="" type="button" class="btn" onclick="sendRequest(this)" id="userLoginApiFormSubmit" value="调用"/></li>
                                                                </ul>   
                                                        </div>

                                                </div>
                                        </div>
                                </div> 
                                <!-----get---->
                                <div id="tab2" class="tabson">

                                        <div class="formtext">
                                                <b>获取用户信息接口</b>
                                        </div>

                                        <div class="mainbox">
                                                <div class="mainleft">
                                                        <div class="leftinfo">
                                                                <div class="listtitle">
                                                                        <!--<a href="#" class="more1">更多</a>-->
                                                                        接口说明
                                                                </div>
                                                                <div class="newlist">  
                                                                        <table  class="gridtable">
                                                                                <tr>
                                                                                        <th>字段名称</th><th>备注</th><th>数据类型</th><th>是否必选</th><th>值</th>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>app_key</td><td>App key</td><td>String</td><td>true</td><td><input type="text" name="app_key" placeholder="必填"  onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>id</td><td>用户id</td><td>int</td><td>true</td><td><input type="text" name="id" placeholder="必填"  onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                        </table>
                                                                </div>

                                                        </div>

                                                </div>
                                                <!--mainleft end-->
                                                <div class="mainright">
                                                        <div class="dflist">
                                                                <div class="listtitle">
                                                                        <!--<a href="#" class="more1">更多</a>-->
                                                                        调用方式
                                                                </div>    
                                                                <ul class="newlist">
                                                                        <li>请求方式：<request_method>get</request_method></li>
                                                                        <li>请求URL：<request_url>/diaoyou_server/Api/UserApi/get_user</request_url></li>
                                                                        <li>请求参数：<request_params></request_params></li>
                                                                        <br/>
                                                                        <li><input name="" type="button" class="btn" onclick="sendRequest(this)" id="userLoginApiFormSubmit" value="调用"/></li>
                                                                </ul>   
                                                        </div>
                                                </div>
                                        </div>
                                </div>
                                <!-----list---->
                                <div id="tab3" class="tabson">

                                        <div class="formtext">
                                                <b>获取用户列表接口</b>
                                        </div>

                                        <div class="mainbox">
                                                <div class="mainleft">
                                                        <div class="leftinfo">
                                                                <div class="listtitle">
                                                                        <!--<a href="#" class="more1">更多</a>-->
                                                                        接口说明
                                                                </div>
                                                                <div class="newlist">  
                                                                        <table  class="gridtable">
                                                                                <tr>
                                                                                        <th>字段名称</th><th>备注</th><th>数据类型</th><th>是否必选</th><th>值</th>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>app_key</td><td>App key</td><td>String</td><td>true</td><td><input type="text" name="app_key" placeholder="必填" onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>pageSize</td><td>页面大小</td><td>int</td><td>true</td><td><input type="text" name="pageSize" placeholder="不填写默认为10" onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>page</td><td>页码</td><td>int</td><td>true</td><td><input type="text" name="pageNumber" placeholder="不填写默认为1"  onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                        </table>
                                                                </div>

                                                        </div>

                                                </div>
                                                <!--mainleft end-->
                                                <div class="mainright">
                                                        <div class="dflist">
                                                                <div class="listtitle">
                                                                        <!--<a href="#" class="more1">更多</a>-->
                                                                        调用方式
                                                                </div>    
                                                                <ul class="newlist">
                                                                        <li>请求方式：<request_method>get</request_method></li>
                                                                        <li>请求URL：<request_url>/diaoyou_server/Api/UserApi/list_user</request_url></li>
                                                                        <li>请求参数：<request_params></request_params></li>
                                                                        <br/>
                                                                        <li><input name="" type="button" class="btn" onclick="sendRequest(this)" id="userLoginApiFormSubmit" value="调用"/></li>
                                                                </ul>   
                                                        </div>

                                                </div>
                                        </div>
                                </div>
                                <!-- 用户注册 -->
                                <div id="tab4" class="tabson">

                                        <div class="formtext">
                                                <b>用户注册</b>
                                        </div>

                                        <div class="mainbox">
                                                <div class="mainleft">
                                                        <div class="leftinfo">
                                                                <div class="listtitle">
                                                                        接口说明
                                                                </div>
                                                                <div class="newlist">  
                                                                        <table  class="gridtable">
                                                                                <tr>
                                                                                        <th>字段名称</th><th>备注</th><th>数据类型</th><th>是否必选</th><th>值</th>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>app_key</td><td>App key</td><td>String</td><td>true</td><td><input type="text" name="app_key" onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>phone</td><td>手机号码</td><td>String</td><td>true</td><td><input type="text" name="phone" onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                                <tr>
                                                                                        <td>password</td><td>密码</td><td>String</td><td>true</td><td><input type="text" name="password" onkeyup="createUrl(this)"/></td>
                                                                                </tr>
                                                                        </table>
                                                                </div>

                                                        </div>

                                                </div>
                                                <div class="mainright">
                                                        <div class="dflist">
                                                                <div class="listtitle">
                                                                        调用方式
                                                                </div>    
                                                                <ul class="newlist">
                                                                        <li>请求方式：<request_method>get</request_method></li>
                                                                        <li>请求URL：<request_url>/diaoyou_server/Api/UserApi/reg_user</request_url></li>
                                                                        <li>请求参数：<request_params></request_params></li>
                                                                        <br/>
                                                                        <li><input name="" type="button" class="btn" onclick="sendRequest(this)" id="userLoginApiFormSubmit" value="调用"/></li>
                                                                </ul>   
                                                        </div>

                                                </div>
                                        </div>
                                </div>

                                <!--
                                <div id="tab5" class="tabson">
                                </div>
                                <div id="tab6" class="tabson">
                                </div>
                                <div id="tab7" class="tabson">
                                </div>
                                <div id="tab8" class="tabson">
                                </div>
                                -->
                                <script type="text/javascript">
                                        $("#usual1 ul").idTabs();
                                </script>
                                <script type="text/javascript">
                                        $('.tablelist tbody tr:odd').addClass('odd');
                                </script>

                        </div>
                        <div id="jsonResultDiv" style="background-color: #EEE;height: 400px;">
                                <textarea id="jsonResultTextArea" style="background-color: #EEE;"></textarea>
                        </div>
        </body>
</html>